import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpAnnex {
  id!: number;
  title!: string;
  type: boolean = true;
  fileName?: unknown;
  fileUrl?: unknown;
  fileId: number = 0;
  url?: unknown;
  typeId!: number;
  img!: unknown;
  content!: unknown;
  isAloneSale: boolean = true;
  priceType: boolean = true;
  price?: string;
  linePrice?: string;
  state: boolean = true;
  uniacid!: number;
  formId: number = 0;
  sales: number = 0;
  defaultSales: number = 0;
  views: number = 0;
  sort: number = 0;
  addTime!: string;
  updateTime!: string;
}

export const ImsYzdKpAnnexSchema = new EntitySchema({
  class: ImsYzdKpAnnex,
  properties: {
    id: { primary: true, type: 'number' },
    title: { type: 'string', length: 255 },
    type: { type: 'boolean', default: true },
    fileName: { type: 'unknown', columnType: 'longtext', nullable: true },
    fileUrl: { type: 'unknown', columnType: 'longtext', nullable: true },
    fileId: { type: 'number', default: 0 },
    url: { type: 'unknown', columnType: 'longtext', nullable: true },
    typeId: { type: 'number' },
    img: { type: 'unknown', columnType: 'longtext' },
    content: { type: 'unknown', columnType: 'longtext' },
    isAloneSale: { type: 'boolean', default: true },
    priceType: { type: 'boolean', default: true },
    price: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    linePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    state: { type: 'boolean', default: true },
    uniacid: { type: 'number' },
    formId: { type: 'number', default: 0 },
    sales: { type: 'number', default: 0 },
    defaultSales: { type: 'number', default: 0 },
    views: { type: 'number', default: 0 },
    sort: { type: 'number', default: 0 },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
  },
});
